import { ref } from "vue";
import { defineStore } from "pinia";

const useSettingStore = defineStore(
  "settingStore",
  () => {
    // 设置默认值才能被 $reset 重置
    const collapse = ref(false);
    const setCollapse = (data: boolean = false) => {
      collapse.value = data;
    };

    return {
      collapse,
      setCollapse,
    };
  },
  {
    persist: {
      enabled: true,

      strategies: [
        {
          storage: sessionStorage,
          paths: ["setting"],
        },
      ],
    },
  } as any
);

export default useSettingStore;
